package com.qfmy.app.controller.community;

import com.qfmy.app.service.community.BlogCommentService;
import com.qfmy.common.result.Result;
import com.qfmy.model.entity.community.BlogComment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.app.controller.community
 * @date 2025/4/17
 * @description 博客评论
 */
@RestController
@SuppressWarnings("all")
@RequestMapping("/app/blogComment")
public class BolgCommentController {

    /**
     * 注入service
     */
    @Autowired
    private BlogCommentService blogCommentService;

    /**
     * 发布评论
     */
    @RequestMapping("/addBlogComment")
    public Result addBlogComment(@RequestParam Integer blogId, @RequestParam String content) {
        blogCommentService.addBlogComment(blogId, content);
        return Result.ok();
    }

    /**
     * 分页获取评论
     */
    @RequestMapping("/getBlogComment")
    public Result<List<BlogComment>> getBlogComment(@RequestParam Integer pageNum, @RequestParam Integer size, @RequestParam Integer blogId) {
        List<BlogComment> blogCommentList = blogCommentService.getBlogComment(pageNum, size, blogId);
        return Result.ok(blogCommentList);
    }

}
